<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
    <title>修改管理员</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <!-- load css -->
	<link rel="stylesheet" th:href="@{/css/font.css}" />
    <link rel="stylesheet" th:href="@{/css/xadmin.css}" />
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
</head>
<body>
    <div class="x-body">
        <form class="layui-form" method="post">
          <div class="layui-form-item">
              <label for="username" class="layui-form-label">
                  <span class="x-red"></span>账号
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="account" disabled="disabled" name="account" th:value="${user.account}" required="required" lay-verify="" autocomplete="off" class="layui-input">
                  <input type="hidden" name="id" th:value="${user.id}"/>
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="name" class="layui-form-label">
                  <span class="x-red"></span>昵称
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="name" name="name" th:value="${user.name}" required="required" lay-verify="" autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">*</span>
              </div>
          </div>
          <div class="layui-form-item">
                <label for="vcode" class="layui-form-label">
                    <span class="x-red"></span>谷歌验证码
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="vcode" name="vcode" th:value="${user.vcode}" 
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red bt">重新生成</span>
                </div>
           </div>
          <div class="layui-form-item">
              <label for="L_email" class="layui-form-label">
                  <span class="x-red"></span>备注
              </label>
              <div class="layui-input-block">
                  <textarea placeholder="请输入内容" id="remarks" name="remarks"  class="layui-textarea" lay-verify="" style="width: 250px;" th:text="${user.remarks}"></textarea>
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red"></span>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <input type="submit" class="layui-btn" lay-filter="update" lay-submit="" value="修改">
          </div>
      </form>
    </div>
    <script>
    $(function() {
    	 $('.bt').click(function () {
             $.get('[[@{/admin/user/code.html}]]',function (result) {
                 $('#vcode').val(result.msg);
             })
         })
        layui.use('form', function(){
          var form = layui.form;
          //监听提交
          form.on('submit(update)', function(data){
        	  $.post('[[@{/admin/user/update.html}]]',data.field,function(result)
        		{
        		  if(result.code==0)
        		  {
        			  
        			  layer.alert(result.msg, {icon: 6},function () {
	                       var index = parent.layer.getFrameIndex(window.name);
	                       parent.layer.close(index);
	                       window.parent.location.replace(window.parent.location.href);
	                   });
        		  }
        		})
            return false;
          });
        });
    })

    </script>
  </body>
</html>
